﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.ComponentModel.Composition;
using Kooboo.Commerce;

namespace Kooboo.Commerce.Payments.PayPal
{
    [Export(typeof(AreaRegistration))]
    public class PayPalAreaRegistration : AreaRegistration
    {
        public override string AreaName
        {
            get
            {
                return "Commerce";
            }
        }

        public override void RegisterArea(AreaRegistrationContext context)
        {
            context.MapRouteEx(
            "PayPal",
            "commerce/shop/payments/paypal",
            new { controller = "PayPal", action = "settings" },
            "/commerce/shop/payments/paypal");

            //Return
            context.MapRoute("PayPal_Return", "commerce/shop/payments/paypal/return/{token}",
                new { controller = "PayPalService", action = "Return", token = UrlParameter.Optional });

            //Cancel
            context.MapRoute("PayPal_Cancel", "commerce/shop/payments/paypal/cancel",
                new { controller = "PayPalService", action = "Cancel" });

            //IPN
            context.MapRoute("PayPal_IPN", "commerce/shop/payments/paypal/ipn/{token}",
                new { controller = "PayPalService", action = "IPN", token = UrlParameter.Optional });
        }
    }
}